Sketch in example of converting waypoints to tracks.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 14 Dec 2005 21:17:30 +0000 (21:17 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 14 Dec 2005 21:17:30 +0000 (21:17 +0000)
gpsbabel/cvttypes.c [new file with mode: 0644]

diff --git a/gpsbabel/cvttypes.c b/gpsbabel/cvttypes.c
new file mode 100644 (file)
index 0000000..b17cf73
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+
+    Convert data between waypoints, tracks, and routes.   
+    
+    Copyright (C) 2005 Robert Lipe   <robertlipe@usa.net>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
+
+ */
+#include "defs.h"
+#include "filterdefs.h"
+
+#define MYNAME "cvttype"
+
+static char *action;
+static route_head *my_trk_head;
+
+static
+arglist_t cvttype_skeleton_args[] = {
+       {"action", &action, "Type of conversion to perform", "wpttotrk", 
+               ARGTYPE_STRING} , 
+       {0, 0, 0, 0, 0}
+};
+
+static void
+cvttype_skeleton_init(const char *args)        
+{
+       my_trk_head = route_head_alloc();
+// route or track
+       track_add_head(my_trk_head);
+}
+
+static void 
+cvttype_skeleton_process(void)
+{
+       queue *elem, *tmp;
+        waypoint *wpt;
+
+       QUEUE_FOR_EACH(&waypt_head, elem, tmp) {
+               waypoint *wpt = (waypoint *)elem;
+
+// if action == to trk
+               waypt_del(wpt);
+               route_add_wpt(my_trk_head, wpt);
+// if action == to rte
+//             waypt_del(wpt);
+//             route_add_wpt(my_rte_head, wpt);
+                       
+       }
+}
+
+static void
+cvttype_skeleton_deinit(void)
+{
+}
+
+filter_vecs_t cvttype_vecs = {
+       cvttype_skeleton_init,
+       cvttype_skeleton_process,
+       cvttype_skeleton_deinit,
+       NULL,
+       cvttype_skeleton_args
+};